<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/3/1
  Time: 22:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
    <title>Title</title>
    <link href="${pageContext.request.contextPath}/resources/css/bootstrap/bootstrap.min.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/resources/js/jquery/jquery-3.1.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/resources/js/bootstrap/bootstrap.min.js"></script>
</head>
<body>
hello word!${course.title}${pathVariable}
<form method="post" action="/test/doUpload" enctype="multipart/form-data">
    <input type="file" name="file"/>
    <input type="submit"/>
</form>

<div id="msgcount"></div>
<div id="result"></div>

<script>
    $(function () {
        $.ajax({
            url: "/test/auditing",
            data: {
                message: '97201'
            },
            success: function (result) {
                $("#weather-temp").html("<strong>" + result + "</strong> degrees");
            }
        });
    });

    if (typeof(EventSource) !== "undefined") {
        var source = new EventSource("sse");
        source.onmessage = function (event) {
            document.getElementById("result").innerHTML += event.data + "<br>";
        };
    }
    else {
        document.getElementById("result").innerHTML = "抱歉，你的浏览器不支持 server-sent 事件...";
    }
</script>
<script>
    var websocket;
    if ('WebSocket' in window) {
        websocket = new WebSocket("ws://localhost:8081/webSocketServer");
    } else if ('MozWebSocket' in window) {
        websocket = new MozWebSocket("ws://localhost:8081/webSocketServer");
    } else {
        websocket = new SockJS("http://localhost:8081/sockjs/webSocketServer");
    }
    websocket.onopen = function (evnt) {
    };
    websocket.onmessage = function (evnt) {
        alert(evnt.data);
        $("#msgcount").html("(<font color='red'>" + evnt.data + "</font>)")
    };
    websocket.onerror = function (evnt) {
    };
    websocket.onclose = function (evnt) {
    }

</script>
</body>
</html>
